﻿<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:dd="clr-namespace:GongSolutions.Wpf.DragDrop;assembly=GongSolutions.Wpf.DragDrop"
             xmlns:ViewModel="clr-namespace:HelpDesk.ViewModel"
             xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
             xmlns:local="clr-namespace:HelpDesk.UserControls"
             xmlns:Commands="clr-namespace:HelpDesk.Commands"
             x:Class="HelpDesk.UserControls.Remote2"
             mc:Ignorable="d"
             d:DesignHeight="500"
             d:DesignWidth="800"
             d:DataContext="{d:DesignData /SampleData/Remote2ViewModelSampleData.xaml}">
    <UserControl.DataContext>
        <ViewModel:Remote2ViewModel />
    </UserControl.DataContext>
    <i:Interaction.Triggers>
        <i:EventTrigger EventName="Unloaded">
            <i:InvokeCommandAction Command="{Binding UnloadedCommand}" />
        </i:EventTrigger>
    </i:Interaction.Triggers>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="122" />
            <ColumnDefinition Width="71*" />
            <ColumnDefinition Width="18*" />
        </Grid.ColumnDefinitions>
        <Grid.RowDefinitions>
            <RowDefinition Height="50" />
            <RowDefinition Height="21*" />
            <RowDefinition Height="254*" />
        </Grid.RowDefinitions>
        <TextBlock Text="Ctrl+1 run default program"
                   Margin="5"
                   Style="{StaticResource DesignerWhiteForegroundStyle}"
                   Grid.ColumnSpan="3" HorizontalAlignment="Center" VerticalAlignment="Center" FontWeight="Bold" FontSize="24" />

        <TextBlock Margin="5"
                   Grid.Row="1"
                   TextWrapping="Wrap"
                   Text="Configuration Path"
                   Height="25"
                   Style="{StaticResource DesignerWhiteForegroundStyle}" />
        <TextBox x:Name="tctConfigurationPath"
                 Grid.Column="1"
                 Margin="5"
                 Grid.Row="1"
                 TextWrapping="Wrap"
                 Height="25"
                 Text="{Binding XmlConfigurationFileLocation}" />
        <Button x:Name="btnBrowse"
                Content="..."
                Grid.Column="2"
                HorizontalAlignment="Left"
                Margin="2,2,0,0"
                Grid.Row="1"
                VerticalAlignment="Center"
                Width="15"
                Height="15.96"
                Padding="0"
                Style="{DynamicResource AccentedSquareButtonStyle}"
				Command="{Binding ConfigurationPathBrowseButtonCommand}" />
        <!--Click="btnBrowse_Click"-->
        <ListBox ItemsSource="{Binding OBRemoteSoftwares}"
                 Grid.Row="2" 
                 Grid.ColumnSpan="4"
                 dd:DragDrop.IsDragSource="True"
                 dd:DragDrop.IsDropTarget="True"
                 x:Name="listBox">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid Margin="5"
                          Width="708"
                          Height="96.92"
                          HorizontalAlignment="Left">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="102" />
                            <ColumnDefinition />
                            <ColumnDefinition Width="Auto"
                                              MinWidth="32" />
                            <ColumnDefinition Width="Auto"
                                              MinWidth="44.317" />
                        </Grid.ColumnDefinitions>

                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"
                                           MinHeight="32" />
                            <RowDefinition Height="Auto"
                                           MinHeight="32" />
                            <RowDefinition Height="Auto"
                                           MinHeight="26" />
                            <RowDefinition Height="0*" />
                        </Grid.RowDefinitions>

                        <!--ProgramPath-->
                        <TextBlock Text="{Binding Name}"
                                   Margin="0,7,10,4" />
                        <TextBox Margin="3,3,14.211,3"
                                 Grid.Row="0"
                                 Grid.Column="1"
                                 Width="Auto"
                                 HorizontalAlignment="Stretch"
                                 Text="{Binding ProgramPath, UpdateSourceTrigger=PropertyChanged}"
                                 Tag="{Binding Name}" />

                        <!--Options-->
                        <TextBlock Text="Options"
                                   Margin="0,7,10,3"
                                   Grid.Row="1" />
                        <TextBox x:Name="txtOptions"
                                 Margin="3,3,14.211,3"
                                 Grid.Row="1"
                                 Grid.Column="1"
                                 Width="Auto"
                                 HorizontalAlignment="Stretch"
                                 Text="{Binding Options, UpdateSourceTrigger=PropertyChanged}" />

                        <!--btnBrows-->
                        <Button x:Name="btnBrows"
                                Grid.Column="2"
                                VerticalAlignment="Stretch"
                                Margin="4.855,0,0,3.5"
                                Height="25"
                                Content="..."
                                Tag="{Binding}"
                                CommandParameter="{Binding}"
                                RenderTransformOrigin="-0.553,0.386"
                                HorizontalAlignment="Left"
                                Width="22.29"
                                Style="{DynamicResource AccentedSquareButtonStyle}"
								Command="{Binding DataContext.SoftwareBrowseButtonCommand, ElementName=listBox}" />
                        <!--Click="btnBrows_Click"-->

                        <!--Default-->
                        <RadioButton x:Name="RadioDefault"
                                     Grid.Row="1"
                                     Grid.Column="2"
                                     Content="Default"
                                     GroupName="Default"
                                     IsChecked="{Binding Default, UpdateSourceTrigger=PropertyChanged}"
                                     Grid.ColumnSpan="2"
                                     Command="{Binding DataContext.DefaultRadioButtonCommand, ElementName=listBox}"
                                     Tag="{Binding}" />
						<!--Checked="RadioDefault_Checked"-->
                        <!--Add Or Remove-->
                        <StackPanel Grid.Column="3"
                                    HorizontalAlignment="Left"
                                    Height="28"
                                    Margin="0"
                                    Grid.RowSpan="1"
                                    VerticalAlignment="Top"
                                    Width="37.025"
                                    Orientation="Horizontal">
                            <Button x:Name="btnAdd"
                                    Content="+"
                                    Margin="0"
                                    Height="17"
                                    Command="{Binding DataContext.AddButtonCommand, ElementName=listbox}"
                                    CommandParameter="{Binding}"
                                    Tag="{Binding Index}"
                                    Style="{DynamicResource AccentedSquareButtonStyle}" />
                            <Button x:Name="btnRemove"
                                    Content="-"
                                    Margin="2,0,0,0"
                                    Height="17"
                                    Width="17"
                                    Command="{Binding DataContext.RmoveButtonCommand, ElementName=listbox}"
                                    CommandParameter="{Binding}"
                                    Tag="{Binding}"
                                    Style="{DynamicResource AccentedSquareButtonStyle}" />
                        </StackPanel>

                        <!--Bottun Name-->
                        <TextBlock x:Name="Bottun_Name"
                                   HorizontalAlignment="Left"
                                   TextWrapping="Wrap"
                                   Text="Bottun Name"
                                   VerticalAlignment="Top"
                                   Grid.Row="2"
                                   Height="15.96"
                                   Width="87.96"
                                   Margin="0,7,0,0" />
                        <TextBox x:Name="txtButtonName"
                                 Margin="3,0,14.211,0"
                                 Grid.Row="2"
                                 Grid.Column="1"
                                 Width="Auto"
                                 HorizontalAlignment="Stretch"
                                 Text="{Binding Name, NotifyOnSourceUpdated=True, UpdateSourceTrigger=PropertyChanged}" />

                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
            <i:Interaction.Behaviors>
                <Commands:ScrollOnNewItem />
            </i:Interaction.Behaviors>
        </ListBox>
    </Grid>
</UserControl>
